package org.elsfs.cloud.common.mybatis.ext.sql.support.executor;


import lombok.RequiredArgsConstructor;
import org.elsfs.cloud.common.mybatis.ext.db.GenericSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.SqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.builder.GenericDeleteSql;

/**
 * 删除SQL执行器
 *
 */
@RequiredArgsConstructor
public class DeleteSqlExecutor extends GenericDeleteSql<DeleteSqlExecutor> implements SqlExecutor<Integer> {
    
    /**
     * 通用SQL执行器
     */
    private final GenericSqlExecutor genericSqlExecutor;

    /**
     * 执行SQL
     *
     * @return 结果
     */
    @Override
    public Integer execute() {
        return this.genericSqlExecutor.delete(
            this.buildSqlFragment(),
            this.getSqlParameterManager().getSqlParameters()
        );
    }
}
